home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / _GUICtrlEditGetLine.au3 < prev    next >
Text File  |  2007-09-08  |  2KB  |  51 lines

  1. #include <GUIConstants.au3>
  2. #include <GuiEdit.au3>
  3.  
  4. opt('MustDeclareVars', 1)
  5.  
  6. Dim $myedit, $Status, $msg, $Btn_GET
  7. Dim $s_text = "AutoIt v3 is a freeware BASIC-like scripting language" & @CRLF & _
  8.           "designed for automating the Windows GUI." & @CRLF & _
  9.           "It uses a combination of simulated keystrokes," & @CRLF & _
  10.           "mouse movement and window/control manipulation" & @CRLF & _
  11.           "in order to automate tasks in a way not possible" & @CRLF & _
  12.           "or reliable with other languages (e.g. VBScript and SendKeys)."
  13.  
  14. ;================================================================
  15. ; Example 1 - Get Line using AutoIt Control
  16. ;================================================================
  17. GUICreate("Edit Get Line", 392, 254)
  18.  
  19. $myedit = GUICtrlCreateEdit($s_text, 140, 32, 121, 97, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $WS_VSCROLL, $WS_HSCROLL, $ES_MULTILINE))
  20. GUICtrlSetLimit($myedit, 1500)
  21. $Status = GUICtrlCreateLabel("", 0, 234, 392, 20, BitOR($SS_SUNKEN, $SS_CENTER))
  22. $Btn_GET = GUICtrlCreateButton("Get Line 3", 150, 130, 90, 40, $BS_MULTILINE)
  23.  
  24. GUISetState()
  25.  
  26. ; Run the GUI until the dialog is closed
  27. While 1
  28.     $msg = GUIGetMsg()
  29.     Select
  30.         Case $msg = $GUI_EVENT_CLOSE
  31.             ExitLoop
  32.         Case $msg = $Btn_GET
  33.             Local $line = _GUICtrlEditGetLine($myedit, 3)
  34.                 If @error == $EC_ERR Then
  35.                 GUICtrlSetData($Status, "Line: Invalid")
  36.             Else
  37.                 GUICtrlSetData($Status, "Line: " & $line)
  38.             EndIf
  39.     EndSelect
  40. WEnd
  41. GUIDelete()
  42.  
  43. ;================================================================
  44. ; Example 2 - Get Line using external Control
  45. ;================================================================
  46. Run("Notepad")
  47. WinWait("Untitled - Notepad")
  48. $myedit = ControlGetHandle("Untitled - Notepad", "", "Edit1")
  49. ControlSetText("Untitled - Notepad","", "Edit1", $s_Text)
  50. MsgBox(0,"Line 4", _GUICtrlEditGetLine($myedit, 4))
  51.